//
//  TranslationFilterAreaItemCell.swift
//  GLUZSwift
//
//  Created by xyanl on 2025/3/20.
//  Copyright © 2025 考拉🐨. All rights reserved.
//

import UIKit
import Reusable

extension TranslationFilterAreaItemCell: NibReusable {}

class TranslationFilterAreaItemCell: UICollectionViewCell {

    @IBOutlet weak var markView: UIView!
    @IBOutlet weak var titleLabel: UILabel!
    
    @IBOutlet weak var arrowImageView: UIImageView!
    @IBOutlet weak var clearButton: UIButton!
    
    var clearBlock: (() -> Void)?
    
    var model: TranslationFilterModel? {
        didSet {
            guard let model = model else { return }
            titleLabel.text = LanguageManager.currentLanguageToText(model.name, model.nameRu) 
            if model.name == "地区选择" {
                arrowImageView.isHidden = false
                clearButton.isHidden = true
            } else {
                arrowImageView.isHidden = true
                clearButton.isHidden = false
            }
        }
    }
    
    @IBAction func clearAction(_ sender: Any) {
        clearBlock?()
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        markView.addRoundedCorners(radius: 10)
        clearButton.isHidden = true
    }

}
